﻿using CAD.BLL;
using CAD.DTO;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WFASmartketing
{
    public partial class Login : Form
    {
        public Login()
        {
            InitializeComponent();
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            string usuario=txtusuario.Text;
            string contrasena = txtcontrasena.Text;
            vendedor vendedro = VendedorBLL.ValidarUsuario(usuario, contrasena);
            if (vendedro!=null) {
            FrmPrincipal prin = new FrmPrincipal(vendedro);
            prin.WindowState = FormWindowState.Maximized;
            prin.Visible = true;
            this.Hide();
            return;
            }
            MessageBox.Show(this,"Verificar usuario y contraseña","DATOS INCORRECTOS");
             txtcontrasena.Text = "";
            txtusuario.Focus();
           
        }

        private void Login_Load(object sender, EventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }
    }
}
